//--------------------------------------------------------------------
#ifndef _dkfile_flash_h
#define _dkfile_flash_h
//--------------------------------------------------------------------

#include "dkfile.h"

//--------------------------------------------------------------------
// DKFLASH_FILESTART sets where the 'fla:' filesystem storage starts

#define DKFLASH_FILESTART	0x20000

//--------------------------------------------------------------------

struct _dk_flash
{
	uint32_t ptr;			// ptr into flash (between start and start+len)
	uint32_t start;			// starting address of this file
	uint32_t len;			// length of this file
};



extern int dkflash_open( DKFILE *stream );
extern int dkflash_close( void *deviceinfo );
extern int dkflash_read_byte(void *deviceinfo);
extern int dkflash_write_byte(void *deviceinfo, int c);
extern int dkflash_read_bytes(void *deviceinfo, int n, void *ptr);
extern int dkflash_write_bytes(void *deviceinfo, int n, void *ptr );
extern int dkflash_seek(void *deviceinfo, off_t offset, int whence);
extern fpos_t dkflash_pos(void *deviceinfo);
extern int dkflash_eof(void *deviceinfo);
extern int dkflash_error(void *deviceinfo);


extern struct _dkdeviceio flashdeviceio;
extern struct _dk_flash dkflash;


//--------------------------------------------------------------------
#endif	// !_dkfile_flash_h
//--------------------------------------------------------------------
